package com.aistar.service.user.impl;

import com.aistar.mapper.CompanyMapper;
import com.aistar.mapper.EmployeeBlacklistMapper;
import com.aistar.model.entity.Company;
import com.aistar.model.entity.EmployeeBlacklist;
import com.aistar.service.user.IMyblacklistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

@Service
@Transactional
public class MyblacklistServiceImpl implements IMyblacklistService {
    @Autowired
    private EmployeeBlacklistMapper employeeBlacklistMapper;
    @Autowired
    private CompanyMapper companyMapper;

    @Override
    public List<Company> black(Integer employeeId) {
        List<Company> lists=new ArrayList<>();
        for(EmployeeBlacklist employeeBlacklist:employeeBlacklistMapper.findByEmployeeId(employeeId)){
            Company company=companyMapper.findById(employeeBlacklist.getCompanyId());
            lists.add(company);
        }
        return lists;
    }

    @Override
    public int DeleteBlack(Integer eid, Integer cid) {
        return employeeBlacklistMapper.DelBlack(eid,cid);
    }
}
